#ifndef GAMEMESSAGE_HH_
#define GAMEMESSAGE_HH_
#include "Network.hh"
#include "XmlMessage.hh"

class Network::GameMessage: public Network::XmlMessage {
    public: static spGameMessage construct(QDomElement const& message);
};

template< class T, class E >
Geom::Vector< T > parse_vector(QDomElement const& vectorElem, E exc = E()) {
    if (!vectorElem.isElement())
        exc();

    QDomElement const xElem = vectorElem.firstChildElement("x");
    QDomElement const yElem = vectorElem.firstChildElement("y");
    return
      Geom::Vector< T >(
        parse_num< T, E >(xElem, exc),
        parse_num< T, E >(yElem, exc)
      );
}

#endif // ndef GAMEMESSAGE_HH_
